import Vue from "vue";
import VueRouter from "vue-router";
import allRoutes from "./generateRoute";
import staticRoutes from "./staticRoutes";
import dynamicRoute from "./dynamicRoutes";

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => {
    console.log(err.toString())
  })
}

Vue.use(VueRouter);

const routes = [
  // {
  //   path:"/",
  //   component:()=>import("@/pages/Home")
  // },
  // {
  //   path:"/login",
  //   component:()=>import("@/pages/Login")
  // }

  // ...allRoutes

  ...staticRoutes,
  dynamicRoute

];

const router = new VueRouter({
  routes,
});

export default router;
